/*
 * Copyright (C) 2015-2021 Alibaba Group Holding Limited
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cx_init.h"
#include "cx_record.h"


static int get_raw_image(int cam_id, char *data, cx_raw_img_type_e *type, int *width, int *height)
{
	if (data == NULL) {
		printf("error input data NULL\n");
		return -1;
	}

	int size = 360 * 640 * 4;
	memcpy(data, (void *)0x6170800, size);
	*type = CX_IMAGE_FORMAT_BGRA;
	*width = 360;
	*height = 640;

	return size;
}

int cx_unit_test()
{
	cx_hal_cbs_t cx_cbs;
	cx_cbs.get_raw_image = get_raw_image;
	
	cx_init(&cx_cbs);

	uint8_t image_name[MAX_RECORD_NAME_LEN];
	cx_record_param_t rec_param;
	rec_param.store_path = "/sdcard/record";
	
	void *cxrecord_hdl = cx_vr_init(&rec_param);

	cx_sleep_ms(1000);
	cx_vr_snapshot(cxrecord_hdl, 0, image_name);
	return 0;
}


